﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Survey.Model.EntriesEntities;

namespace Survey.Data
{
    class Program
    {
        static void Main(string[] args)
        {
            SaveEntities();
            ShowEntities();
            Console.ReadKey();
        }

        private static void SaveEntities()
        {
            var context = new SurveyContext();
            context.ContextOptions.LazyLoadingEnabled = true;
            LearningMaterial material = new LearningMaterial() { Description = "asdfasdfasdfasdf", MaterialName="SDFDFDSSDF", MaterialCode=1234 ,NumberOfPages=10 };
            context.AddObject("LearningMaterialSet", material);
            context.SaveChanges();
        }

        private static void ShowEntities()
        {
            var context = new SurveyContext();
            context.ContextOptions.LazyLoadingEnabled = true;
            var post = context.LearningMaterials.ToList();
            foreach (var diretor in post)
            {
                Console.WriteLine("Post id: {0} Body: {1}", diretor.Id, diretor.MaterialCode); 
            }
        }
    }
}
